home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / oppopwin.zip / OPPOPWIN.DOC < prev    next >
Text File  |  1992-03-31  |  8KB  |  218 lines

  1.  ***************************************************************************
  2.  *                                                                          *
  3.  *                      POPWINDOW Version 1.0                               *
  4.  *                      Dated  : 03/06/92                                   *
  5.  *                      Author : Hans Otten                                 *
  6.  *                                                                          *
  7.  *          The latest version, allong with the author, can always          *
  8.  *          be found at the LONDON PC USERS GROUP BBS (519-472-9471)        *
  9.  *          located in London, Ontario. (Canada that is ...)                *
  10.  *                                                                          *
  11.  ****************************************************************************
  12.  
  13.  
  14.  Introduction
  15.  ------------
  16.  
  17.      OPPOPWIN was my first attempt to use Object Professional To create my
  18.  own descendant object instead of just declaring instances of ones.  The
  19.  OPPOPWIN unitdeclares an object called PopWindow which is a pop up
  20.  window that is displayed on the screen.  The reason for writing this
  21.  object was two fold.  First off, I found it very frustrating to write
  22.  a pop up menu using the OPMENU unit in Object Professional.  Secondly,
  23.  before I used OP I was usin TecknoJock's Turbo Toolkit.  One of the
  24.  units in this toolkit was MENUTTT5 which had a simple menu that I could
  25.  use.  Therefore, when I moved over to OP, I descided to duplicate the
  26.  menu system for my own use.
  27.      As you might have noticed, this release is version 1.0, which means
  28.  it probably still has some bugs in it.  It is also missing some key features
  29.  that are common to most of OP's objects, most notably error handling and
  30.  stream support.  As I become more familiar with OOP and Object Professional,
  31.  I hope to improve upon this code.
  32.  
  33.  Legality and Junk
  34.  -----------------
  35.  
  36.      Before I start into the documentation, I have to put this little
  37. statement in for my own peace of mind.  I (Hans Otten) assume no
  38. responsability for any loss or damage caused by this program.  This code
  39. is being released to the public domain as FreeWare.  You may modify the code,
  40. hack it, or use it in any capacity you see fit.  All I ask is that, if you
  41. make any substantial changes to the code, please drop me a note on one
  42. of the following places.
  43.  
  44.    - In the Pascal Conference of I'Net.
  45.    - At the London PC Users Group BBS (519) 472-9471.
  46.    - Rose Media BBS (416) 733-2285.
  47.  
  48.    Or if you prefer to write, send me a letter at :
  49.  
  50.       272 Homestead Crescent
  51.       London, Ontario
  52.       N6G 2E5
  53.       Canada.
  54.  
  55. On to the Documentation
  56. -----------------------
  57. -------------
  58. | CONSTANTS |
  59. -------------
  60. KeyMax      = 120;
  61.  - Maximum # of keys in keyset used by the POPWINDOW Command set
  62.  
  63. MaxNumPicks =  20;
  64.  - Maximum number of selections in one menu (This can be modified)
  65.  
  66. MaxTopicLen =  80;
  67.  - Maximum length of each topic in the menu (This can also be modified)
  68.  
  69. ccScrollWin = ccUser50;
  70.  - Command in command set to allow the window to be moved somewhere else.
  71.  
  72. Ident : String[15] = 'Popwin Key Set';
  73. KeySet : Array[0..KeyMax] of Byte = (.....)
  74. CfgEnd : Byte = 0;
  75.   - A defined keyset to be used with the PopWindow.
  76.  
  77. AllowSet : Array[1..2] of Set of Char =
  78.            (['1','2','3','4','5','6','7','8','9'],
  79.            ['A'..'Z']);
  80.   - The two defined sets of lead in characters for each menu topic.
  81.  
  82.  
  83. PopWindowFrame : FrameArray = '▀'+' '+'▀'+' '+
  84.                               '▀'+' '+' '+' ';
  85.   - My own unique window frame for the PopWindow.
  86.  
  87. The next four contants are options which affect the PopWindow's
  88. operations.
  89.  
  90. ppStick       = $0001;
  91.  - Stick on menu selections.  When the user selects a menu topic with the
  92.    mouse, if the topic is not highlighted, then the highlight bar will move
  93.    to it, but not act upon it.
  94.  
  95. ppCapitalize  = $0002;
  96.  - Capitalize the current highlighted menu choice.  PopWindow will
  97.    temporarily convert the highlighted topic to all capital letters.
  98.  
  99. ppUseLetters  = $0004;
  100.  - By default PopWindow uses numbers as lead ins to each topic, however
  101.    you can force PopWindow to use Letters by wnabling this option.  Note
  102.    that if there are more than 9 topics in the menu, PopWindow will
  103.    automatically switch over to letters.
  104.  
  105. ppAllowEsc    = $0008;
  106.  - Allow the user to exit the menu by pressing ESC.  If this option is not
  107.    turned on, then pressing ESC will just move the highlight bar to the
  108.    last option in the current menu.
  109.  
  110. DefPopWindowOptions = 0;
  111.  - Default window options.
  112.  
  113. ---------
  114. | TYPES |
  115. ---------
  116.  
  117. PopWindowPtr = ^PopWindow;
  118. PopWindow =
  119.            Object(CommandWindow)
  120.              ...
  121.            End;
  122.  
  123. -------------
  124. | VARIABLES |
  125. -------------
  126.  
  127. PopCommands : CommandProcessor;
  128.  
  129.  
  130. -----------
  131. | METHODS |
  132. -----------
  133.  
  134. Function GetTopicNum(TopicId : Byte) : Byte;
  135.  - All topics in the menu have a TopicID which you define.  This function
  136.    returns the location in the menu of TopicId.  If TopicId does not exist,
  137.    it will return 0.
  138.  
  139.  
  140. Function GetTopicId(TopicNum : Byte) : Byte;
  141.  - This function does the exact opposite of GetTopicNum.  GetTopicId will
  142.    return the TopicID of TopicNum.  If TopicNum is not a location in the
  143.    menu, 0 is retuned.
  144.  
  145.  
  146. Constructor Init(X1, Y1, X2, Y2:Byte; NumHeaders : Byte; Var Colors : ColorSet);
  147.  - The Constructor takes as coordinates the size of the menu, # of headers
  148.    you want to add at the top of the meny (Maximum of 2), and a color set.
  149.  
  150.  
  151. Procedure AddHeaders(H1,H2 : String);
  152.  - This procedure will add up to 2 headers to the top of the menu.  note
  153.    that Init automatically expands the menu in order to incorporate
  154.    the headers.
  155.  
  156.  
  157. Procedure AddTopic(TopicName : String; TopicId : Byte);
  158.  - This procedure should be used to add a topic to the menu.  It takes as
  159.    input the Name of the topic (As it will be displayed on the menu),
  160.    and a unique TopicID by which you can identify it by.
  161.  
  162.  
  163. Procedure SetDefaultChoice(TopicId : Byte);
  164.  - Set the default choice to start on when the process method is called.
  165.    Note, when PopWindow is initialized, it automaticallys sets itself to
  166.    the first choice added with AddTopic.
  167.  
  168. Function GetLastChoice : Byte;
  169.  - Return the last selection by user, returns the choice ID.
  170.  
  171. Function GetMaxChoices : Byte;
  172.  - Return total number of entries in menu.
  173.  
  174. Procedure GetCoordinates(Var X1, Y1, X2, Y2 : Byte);
  175.  - Get the coordinates of the menu.
  176.  
  177. Procedure SetPadLength(Len : Byte);
  178.  - Sets the number of spaces between the left margin and the topics.
  179.    Note that the minimum value is 4.
  180.  
  181. Procedure SetSelectorChar(CH : Char);
  182.  - Sets the character to be written in the left margin when the
  183.    current topic is highlighted.  By default this character is ""
  184.  
  185.  
  186. Function ppOptionsAreOn(SelOptions : Word) : Boolean;
  187.  - Determine what option(s) are turned on.
  188.  
  189. Procedure ppOptionsOn(SelOptions : Word);
  190.  - Turn selected option(s) on
  191.  
  192. Procedure ppOptionsOff(SelOptions : Word);
  193.  - Turn selected option(s) off
  194.  
  195. Procedure ScrollWindow(XT,YT,XB,YB : Byte);
  196.  - Move the menu to another location, within the defined boundaries given.
  197.    This procedure uses the Arrow keys to move the window, and the ENTER
  198.    or ESC key to exit the procedure.
  199.  
  200. Procedure ChangeTopic(TopicNum : Byte; NewTopic : String; RedrawMenu : Boolean);
  201.  - Change the topic description.  RedrawMenu askes if the whole menu should
  202.    be redrawn or not.
  203.  
  204. Procedure RemoveTopic(TopicNum : Byte; MoveRemaining : Boolean);
  205.  - Remove a topic from the menu.  MoveRemaining will shift all remaining topics
  206.    up one notch and redraw the menu.
  207.  
  208. Procedure SwitchTopics(Topic1, Topic2 : Byte);
  209.  - Swith the topic entries for 2 topics.
  210.  
  211. Procedure Draw; Virtual;
  212.  - Draw the menu.
  213.  
  214. Procedure Process; Virtual;
  215.  - Process the menu commands.
  216.  
  217.  
  218.